package thread;

/**
 * 当前一个线程调用Thread。sleep()方法处于睡眠阻塞的过程中，若该线程的interrupt()方法被调用时，会
 * 中断该线程的睡眠阻塞，此时该线程会抛出中断异常.
 */
public class SleepDemo2 {
    public static void main(String[] args) {
        /** 中断该线程的睡眠阻塞,该线程会抛出中断异常 */
        Thread len = new Thread(){
          public void run(){
              System.out.println("腿一定眼一闭睡~");
              try {
                  Thread.sleep(80000);
              } catch (InterruptedException e) {
                  System.out.println("daote");
              }
              System.out.println("醒,骂街~");
          }
        };
        Thread boo = new Thread(){
            public void run(){
                System.out.println("开始工作!");
                for(int i=0;i<10;i++){
                    System.out.println("biubiu(づ￣3￣)づ╭❤～");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("执行结束!");
                len.interrupt();//中断该线程的睡眠阻塞
            }
        };

        len.start();
        boo.start();

    }
}
